﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace NigiriClub.WebUI.Models
{
    public partial class Account : ICloneable
    {
        public string ExName { get; set; }
        public string ExternalLoginData { get; set; }
        public FileModel AvatarFile { get; set; }

        static public Account GetAccount(string name)
        {
            using (Entities db = new Entities())
            {
                return db.Account.FirstOrDefault(x => x.Name == name);
            }
        }

        public Object Clone()
        {
            return new Account()
            {
                Id = this.Id,
                Name = this.Name,
                FullName = this.FullName,
                Level = this.Level,
                PermissionId = this.PermissionId,
                Avatar = this.Avatar
            };
        }
    }
}